# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=prompt_toolkit
pkgbase=mingw-w64-python-${_realname}
pkgname=(
  "${MINGW_PACKAGE_PREFIX}-python3-${_realname}"
  "${MINGW_PACKAGE_PREFIX}-python2-${_realname}"
)
pkgver=1.0.3
pkgrel=1
pkgdesc="Library for building powerful interactive command lines in Python"
url="https://github.com/jonathanslenders/python-prompt-toolkit"
arch=('any')
license=('BSD')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python3-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
)
checkdepends=(
  "${MINGW_PACKAGE_PREFIX}-python3-pytest"
  "${MINGW_PACKAGE_PREFIX}-python2-pytest"
)
source=(python-prompt-toolkit-${pkgver}.tar.gz::https://github.com/jonathanslenders/python-prompt-toolkit/archive/${pkgver}.tar.gz)
sha256sums=('496a70f54781cee48fe1bd91b846267055c9e6df87ab70d08fe1ef84a9adaad9')

prepare() {
  cp -a python-prompt-toolkit-${pkgver}{,-py2}
}

build() {
  cd ${srcdir}/python-prompt-toolkit-${pkgver}
  python3 setup.py build

  cd ${srcdir}/python-prompt-toolkit-${pkgver}-py2
  python2 setup.py build
}

#check() {
#    cd ${srcdir}/python-prompt-toolkit-${pkgver}
#    py.test-3.5

#    cd ${srcdir}/python-prompt-toolkit-${pkgver}-py2
#    py.test-2.7
#}

package_python3-prompt_toolkit() {
  depends=(
    "${MINGW_PACKAGE_PREFIX}-python3-pygments"
    "${MINGW_PACKAGE_PREFIX}-python3-six"
    "${MINGW_PACKAGE_PREFIX}-python3-wcwidth"
  )

  cd ${srcdir}/python-prompt-toolkit-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-prompt_toolkit() {
  depends=(
    "${MINGW_PACKAGE_PREFIX}-python2-pygments"
    "${MINGW_PACKAGE_PREFIX}-python2-six"
    "${MINGW_PACKAGE_PREFIX}-python2-wcwidth"
  )

  cd ${srcdir}/python-prompt-toolkit-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-prompt_toolkit() {
  package_python2-prompt_toolkit
}

package_mingw-w64-i686-python3-prompt_toolkit() {
  package_python3-prompt_toolkit
}

package_mingw-w64-x86_64-python2-prompt_toolkit() {
  package_python2-prompt_toolkit
}

package_mingw-w64-x86_64-python3-prompt_toolkit() {
  package_python3-prompt_toolkit
}

# vim:set ts=2 sw=2 et:
